unsigned char iterations(int re, int im, int s)
{
	int cRe = re;
	int cIm = im;
	int zRe = 0, zIm = 0;
	unsigned char k = 0;

	while( (zRe*zRe/s + zIm*zIm/s <= 4*s) && (k < 255) ) {
		int zReOld = zRe;
		/* Compute z = z^2 + c */
		zRe = zRe*zRe/s - zIm*zIm/s + cRe;
		zIm = 2*zIm*zReOld/s + cIm;
		/* Increment iteration number */
		k += 1;
	}

	return k;
}
